import 'package:flutter/material.dart';

class StatelessComp extends StatelessWidget {
  const StatelessComp({super.key, required this.userName, this.gender});

  // 定义属性接收父组件传值
  final String userName;
  final String? gender;

  final String _intro = '这是一个神奇的组件';

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Text('我是无状态组件，我的用户名是：$userName, 性别是：$gender'),
        Text(_intro),
      ],
    );
  }
}
